﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Zzva.Common;
using System.Data;


namespace Zzva.ESB
{
    public class TSysWorkprogress
    {

        private static TSysWorkprogress mvarSysWorkprogress;
        private SqlConnection  mvarConnect;


        protected TSysWorkprogress(SqlConnection pConnect)
        {
            try { mvarConnect = pConnect; }
            catch (Exception e) { throw e; }
            finally { }
        }



        public static TSysWorkprogress GetSystem()
        {
                try
                {
                    if (mvarSysWorkprogress == null) { mvarSysWorkprogress = GetSysWorkprogress(); }

                    return mvarSysWorkprogress;
                }

                catch (Exception e) { throw e; }
                finally { }
        }



        private static TSysWorkprogress GetSysWorkprogress()
        {
            string lConnectStr;
            SqlConnection lConnect;
            TSysWorkprogress lSysWorkprogress;

            try
            {
                //!!!!!!!!!!!!!
                //достаем Connect из установок
                ////Connect = RegisterLokal.GetSetting("Common", "SysBuhuchConnect");
                
                //lConnectStr = "Data Source=TEH-SRV;Initial Catalog=NezavProizv;Integrated Security=True;";
                //lConnectStr = lConnectStr + "User ID=" + User + ";Password=" + Password + ";";
                lConnectStr = "Data Source=TEH-SRV;Initial Catalog=NezavProizv;Integrated Security=True;"
                           + "User ID=Sergey;Password=Cl254J;";


                lConnect = new SqlConnection(lConnectStr);
                lConnect.Open();
                lSysWorkprogress = new TSysWorkprogress(lConnect);
                return lSysWorkprogress;
            }
            catch (Exception e) { throw e; }
            finally { }
        }




        public string TestConnect() { return "YesConnectWorkprogress"; }  



  



    






    }
}
